from loop import coroutine, YieldLoop


@coroutine
def test1():
    _sum = 0
    for i in range(1, 11):
        if i % 2 == 1:
            _sum += yield i
    print("sum = {}".format(_sum))


if __name__ == '__main__':
    YieldLoop.instance().add_coroutine(test1())
    YieldLoop.instance().run_until_complete()